package com.castle.fortress.admin.cms.fragment;

import com.castle.fortress.admin.cms.dto.CmsLinkCategoryDto;
import com.castle.fortress.admin.cms.service.CmsLinkCategoryService;
import com.castle.fortress.admin.utils.SpringUtils;
import org.beetl.core.tag.GeneralVarTagBinding;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * cms 友链分组 标签
 * @author castle
 */
public class CmsLinkGroupTag extends GeneralVarTagBinding {

	@Override
	public void render() {
		Map<String,Object> map = new HashMap<>();
		if(containHtmlAttribute("code")){
			map.put("code",getAttributeValue("code"));
		}
		CmsLinkCategoryService cmsLinkCategoryService = SpringUtils.getBean(CmsLinkCategoryService.class);
		List<CmsLinkCategoryDto> list = cmsLinkCategoryService.cmsTagListCmsLinkGroup(map);
		this.binds(list);
		this.doBodyRender();
	}
}
